import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;

class ImagePanel extends JPanel {

  private Image img;

  public ImagePanel(String img) {
    this(new ImageIcon(img).getImage());
  }

  public ImagePanel(Image img) {
    this.img = img;
    
    Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
    setPreferredSize(size);
    setMinimumSize(size);
    setMaximumSize(size);
    
    setVisible(true);
    setSize(size);
    setLayout(null);
    
    JButton rejestr= new JButton("Rejestruj");
	
	rejestr.setBounds(100, 100, 100, 50);
	add(rejestr);
	
	rejestr.addActionListener(new ActionListener() {
		
		@Override
		public void actionPerformed(ActionEvent e) {
			EventQueue.invokeLater(new Runnable()
			{
				public void run(){
		
					setVisible(false);
					test.checkVisible[1].setVisible(true);

				}
			});
			
		}
	});
	JButton logg= new JButton("Zaloguj");
	
	logg.setBounds(400, 100, 100, 50);
	add(logg);
	
	logg.addActionListener(new ActionListener() {
		
		@Override
		public void actionPerformed(ActionEvent e) {
			EventQueue.invokeLater(new Runnable()
			{
				public void run(){
					
					setVisible(false);
					test.checkVisible[5].setVisible(true);
					
				}
			});
			
		}
	});
  }

  public void paintComponent(Graphics g) {
    g.drawImage(img, 0, 0, null);
  }

}